//
//  WJBaserTabBarVC.m
//  WJBSApp
//
//  Created by dllo on 16/7/14.
//  Copyright © 2016年 王景伟. All rights reserved.
//

#import "WJBaserTabBarVC.h"

@interface WJBaserTabBarVC ()

@end

@implementation WJBaserTabBarVC

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"Mode"] isEqualToString:@"night"]) {
            self.tabBar.barTintColor = FIRBLACKCOLOR;
        }else{
            self.tabBar.barTintColor = LABLECOLOR;
        }
        // 创建观察者
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor:) name:@"changeColor" object:nil];
        
    }
    return self;
}

//通知方法
- (void)changeColor:(NSNotification *)notification{
    
    if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"Mode"] isEqualToString:@"night"]) {
        self.tabBar.barTintColor = FIRBLACKCOLOR;
    } else {
        self.tabBar.barTintColor = LABLECOLOR;
    }
}

//重写dealloc 删除通知
-(void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"changeColor" object:nil];
    [super dealloc];
}








@end
